<div class="container-fluid">
  <div class="row-fluid">
    <div class="span12">       
    <form role="form" id="form" action="{:U('Activity/question_add',array('id'=>$id))}">    
        <div class="form-group">
          <label for="name">问题</label>
          <input type="text" class="form-control" placeholder="例：您对附近的绿化有什么建议？" name="question" required="required" />
        </div>
        <div class="form-group">
          <label for="name">类型</label>
          <select name="type" id="tesetSelect" form="form"  onchange="tt(this.id)">
         <!--    <option value="0">填写类型</option> -->
             <option value="1">选择类型</option>
          </select>
        </div>  
        <div class="form-group" id="checkbox">
            <label for="name">选项</label>
            <button type="button" class="btn btn-primary" id="button">添加选项</button>
          <!--   <button type="button" class="btn btn-danger" id="button_del">减少选项</button> -->
              <br />  
              
                <div class="check">选项1<input type="text"  class="form-control" style="width:600px" placeholder="例：很好" name="name[1]"  />  <button type="button" class="btn btn-danger del">删除</button>
                </div>
        </div>
    <button type="submit" class="btn btn-default">提交</button>
</form>
    </div>
  </div>
</div>

<script type="text/javascript">
var i = 2;
 $("#button").click(function(){
    var html = '<div class="check">选项'+i+'：<input type="text" class="form-control" style="width:600px" name="name['+i+']"><button type="button" class="btn btn-danger del">删除</button></div>';
    $('#checkbox').append(html);
    i++;
 });

/*$(".del").click(function(){
  $(this).parents(".check").remove();
});*/

$("#checkbox").delegate(".del","click",function(){
  $(this).parents(".check").remove();
});

//根据菜单类型，弹出适当的选项
var a=$('#tesetSelect').val();//选中的值   
//alert(a);
if (a=='0') {
      $("#checkbox").hide();

      //$("#checkbox").remove();
  };
if (a=='1') {
     $("#checkbox").show();
     //$("#checkbox").append();
};
function tt(id) {
  var aa = document.getElementById(id).value;
  var a=aa;
// alert(a);
  if (a=='0') {
      $("#checkbox").hide(); 
      //$("#checkbox").remove();
  };
  if (a=='1') {
      //$("#checkbox").append();
      $("#checkbox").show();
  };
 }
</script>